#include "MyPosCreator.hh"
#include <iostream>

MyPosCreator::MyPosCreator()
{
    m_MyPosName = "SimpleParticleGun";
}

MyPosCreator::~MyPosCreator(){}

void* MyPosCreator::CreateNewMyPos(std::string name)
{
    if (m_AvaiableMyPos.find(name) != m_AvaiableMyPos.end())
    {
        m_MyPosName = name;
    }
    else
    {
        std::cout << "Warning!!! MyPos Type \" " << name << " \" NOT FOUND!!! Use default MyPos \" SimpleParticleGun \"." << std::endl;
        std::cout << "Avaiable Type:" << std::endl;
        for(const auto& FPtr:m_AvaiableMyPos)
            std::cout << "  " << FPtr.first << std::endl;
        m_MyPosName = "SimpleParticleGun";
    }

    auto iter = m_AvaiableMyPos.find(m_MyPosName);
    CreateMyPos myPos = iter->second;
    return myPos();
}


